using System;
using System.Collections.Generic;
using System.Text;
using THSLib;
using THSERP.BaseProvider;
using THSERP.BusinessEntities;
namespace THSERP.Modules.Food
{
    public class FoodEntities : ERPModuleEntities
    {
        #region Constants
        public const string cstLIFoodGroupsObjectName = "LIFoodGroups";
        #endregion

        #region Declare all entities variables
        protected LIFoodGroupsInfo _lIFoodGroupsObject;
        public THSTreeList lstLIFoodGroups;
        public THSList<LIFoodGroupsInfo> lstFood;
        #endregion

        #region Public Properties
        public LIFoodGroupsInfo LIFoodGroupsObject
        {
            get
            {
                return _lIFoodGroupsObject;
            }
            set
            {
                _lIFoodGroupsObject = value;
            }
        }

        public THSTreeList LIFoodGroupsList
        {
            get
            {
                return lstLIFoodGroups;
            }
            set
            {
                lstLIFoodGroups = value;
            }
        }

        public THSList<LIFoodGroupsInfo> FoodList
        {
            get
            {
                return lstFood;
            }
            set
            {
                lstFood = value;
            }
        }
        #endregion

        #region Constructor
        public FoodEntities()
            : base()
        {

            _lIFoodGroupsObject = (LIFoodGroupsInfo)new LIFoodGroupsController().GetFirstObject();
            if (_lIFoodGroupsObject == null)
                _lIFoodGroupsObject = new LIFoodGroupsInfo();

            lstLIFoodGroups = new THSTreeList();
            lstFood = new THSList<LIFoodGroupsInfo>();

        }
        #endregion

        public override void InitModuleEntity()
        {
            base.InitModuleEntity();

            UpdateModuleObjectBindingSource(cstLIFoodGroupsObjectName);
        }
        #region Init Main Object,Module Objects functions
        public override void InitModuleObjects()
        {
            ModuleObjects.Add(FoodEntities.cstLIFoodGroupsObjectName, LIFoodGroupsObject);
        }

        public override void InitModuleObjectList()
        {
            lstLIFoodGroups = new THSTreeList();
           // lstFood = new THSList<LIFoodGroupsInfo>();
            lstLIFoodGroups.InitTHSList(this, string.Empty, FoodModule.cstLIFoodGroupsObjectName,THSList<LIFoodGroupsInfo>.cstRelationParent);
            lstFood.InitTHSList(this, "", "LIFoodGroups");
        }

        public override void InitGridControlInTHSList()
        {
            LIFoodGroupsList.InitTHSTreeListControl("fld_trlLIFoodGroups");
            lstFood.InitTHSListGridControl();
            
        }
        public override void SetDefaultModuleObjectsList()
        {
            LIFoodGroupsList.SetDefaultListAndRefreshTreeListControl();
            FoodList.SetDefaultListAndRefreshGridControl();
        }
        #region Invalidate Module Objects functions
        public override void InvalidateModuleObjects(int iObjectID)
        {
            LIFoodGroupsList.InvalidateTreeList(iObjectID);
            lstFood.Invalidate(iObjectID);
        }
        #endregion
        #endregion 
    }
}
